package com.hzlj.position.locate.dao;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.stereotype.Repository;
import com.fz.common.base.dto.PageParamDTO;
import com.fz.common.base.dto.QueryPageResultDTO;
import com.fz.common.base.dto.DeleteCommonDTO;
import com.fz.common.base.converter.RemoveWrapperPlus;
import com.fz.common.base.converter.QueryWrapperConverterPlus;
import com.hzlj.position.locate.mapper.DifferentiationDataMapper;
import com.hzlj.position.locate.common.model.DifferentiationData;
import com.hzlj.position.locate.common.dto.differentiationData.DifferentiationDataQueryParamDTO;
import com.hzlj.position.locate.common.dto.differentiationData.DifferentiationDataQueryResultDTO;
import javax.annotation.Resource;
import java.util.List;
import java.util.Date;
import cn.hutool.core.util.ObjectUtil;
/**
 * 独立业务-数据(DifferentiationData)表操作类
 *
 * @author makejava
 * @date 2024-08-16 15:13:19
 */
@Repository
public class DifferentiationDataDao  extends ServiceImpl<DifferentiationDataMapper, DifferentiationData>  {
    @Resource
    private DifferentiationDataMapper differentiationDataMapper;
    
    
    /**
     * 修改数据
     */
    public boolean updateDifferentiationData(DifferentiationData dto){
        LambdaQueryWrapper<DifferentiationData> queryWrapper = new QueryWrapper<DifferentiationData>().lambda()
                .eq(DifferentiationData::getId,dto.getId());
        return this.update(dto, queryWrapper);
    }
    
    /**
     * 删除数据
     */
    public boolean deleteDifferentiationData(DeleteCommonDTO<Long> dto) {
        return RemoveWrapperPlus.remove(this, dto);
    }
    
    /**
     * 查询列表：不分页
     */
    public List<DifferentiationDataQueryResultDTO> listDifferentiationData(DifferentiationDataQueryParamDTO dto){
        return QueryWrapperConverterPlus.of(differentiationDataMapper)
                .list(DifferentiationDataQueryResultDTO.class, dto);
    }
    
    /**
     * 查询列表：分页
     */
    public QueryPageResultDTO<DifferentiationDataQueryResultDTO> pageDifferentiationData(DifferentiationDataQueryParamDTO dto,PageParamDTO page){
        return QueryWrapperConverterPlus.of(differentiationDataMapper)
                .page(DifferentiationDataQueryResultDTO.class, dto, page);
    }
}

